include( QxTarget.h )

unix:CONFIG += debug
win32:CONFIG += debug_and_release
CONFIG += build_all

CONFIG(debug, debug|release) {
  TARGET = $$member(TARGET, 0)d
  SUFFIX_STR = Debug
  DEFINES += DEBUG
} else {
  SUFFIX_STR = Release
}

INCLUDEPATH   += ./ $${SOURCE_ROOT}

ARCH = $$QMAKE_HOST.arch

PLATFORM_DEST  = $${TARGET_ROOT}/$${PLATFORM}/$${ARCH}

isEmpty( OBJ_DIR ) {
  OBJ_DIR = obj/$$replace( SOURCE_DIR, $${SOURCE_ROOT}/, "" )
}

UI_DIR         = ui
MOC_DIR        = moc
OBJECTS_DIR    = $${PLATFORM_DEST}/$${OBJ_DIR}/$${SUFFIX_STR}
RCC_DIR        = $${OBJECTS_DIR}

isEmpty( DESTDIR ) {
  DESTDIR = $${PLATFORM_DEST}/$${PRJ_DIR}
}

unix {
  LIBS += -Wl,-rpath,$${PLATFORM_DEST}/lib
  LIBS += -Wl,-rpath,$${SOURCE_ROOT}/lib/$${PLATFORM}/$${ARCH}
  LIBS += -Wl,-rpath,$${PLATFORM_DEST}/$${PRJ_DIR}
}

LIBS += -L$${SOURCE_ROOT}/lib
LIBS += -L$${PLATFORM_DEST}/lib
LIBS += -L$${PLATFORM}/$${ARCH}
LIBS += -L$${DESTDIR}


for( lib, DEPEND_LIBS ) {
  CONFIG(debug, debug|release) {
    lib = $$member(lib, 0)d
  }
  LIBS += -l$${lib}
}

DEPENDPATH    += $${INCLUDEPATH}
